<?php
	class Model_pay extends CI_Model{
		protected $_table = "tbl_order";
		protected $_day   = "tbl_days";
		protected $_gold  = "tbl_ordergold";
		protected $_goldtime  = "tbl_goldtime";
		public function __construct(){
			parent::__construct();
			$this->load->database();
		}
		public function add($data){
			$this->db->insert($this->_table,$data);
		}
		public function add_gold($data){
			$this->db->insert($this->_gold,$data);
		}
		public function update_room($data,$id){
			$this->db->where("day_id",$id);
			$this->db->update($this->_day,$data);
		}
		public function update_order($data,$id){
			$this->db->where("order_code",$id);
			$this->db->update($this->_table,$data);
		}
		public function update_gold_order($data,$id){
			$this->db->where("order_code",$id);
			$this->db->update($this->_gold,$data);
		}
		public function update_goldtime($data,$id){
			$this->db->where("gold_id",$id);
			$this->db->update($this->_goldtime,$data);
		}
		public function count_gold($type){
		  	$this->db->where("order_gold_type",$type);
			$this->db->where("order_status","1");
			return $this->db->count_all_results($this->_gold);
		}
	}